#ifndef __BSP_RTC_H__
#define __BSP_RTC_H__

#include "imx6u.h"

#define SECONDS_IN_A_DAY			(3600*24)
#define SECONDS_IN_A_HOUR			(3600)
#define SECONDS_IN_A_MINUTE			(60)
#define DAYS_IN_A_YEAR				(365)
#define YEAR_RANGE_START			(1970)
#define DAYS_RANGE_END				(2099)


/* 和时间有关的结构体 */
struct rtc_datetime {
	unsigned short 	year;
	unsigned short	month;
	unsigned char	day;
	unsigned char	hour;
	unsigned char	minute;
	unsigned char	second;
};


void rtc_init(void);
void rtc_disable(void);
void rtc_enable(void);
void rtc_setdatetime(struct rtc_datetime *datetime);
uint64_t rtc_getseconds(void);
void rtc_convertseconds_to_datetime(u64 seconds, struct rtc_datetime *datetime);
void rtc_getdatetime(struct rtc_datetime *date);

#endif